package com.mingren.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mingren.api.aliyunai.model.CreateOutPaintingTaskResponse;
import com.mingren.api.aliyunai.modelPictureToMp4.CreateOutMp4askResponse;
import com.mingren.model.domain.Picture;
import com.mingren.model.domain.User;
import com.mingren.model.dto.pictureRequest.*;
import com.mingren.model.vo.PictureVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author ROG
 * @description 针对表【picture(图片)】的数据库操作Service
 * @createDate 2025-02-27 14:57:14
 */
public interface PictureService extends IService<Picture> {


    /**
     * 校验图片
     *
     * @param picture
     */
    void validPicture(Picture picture);

    /**
     * 上传图片
     *
     * @param inputSource          : 文件流
     * @param pictureUploadRequest : 图片上传/修改请求体
     * @param loginUser            : 当前登录用户
     * @return
     */
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 返回照片查询请求体
     *
     * @param pictureQueryRequest
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 获取单个脱敏后的图片信息
     *
     * @param picture
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);


    /**
     * 开发审核服务->图片审核
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);

    /**
     * 分页获取图片封装
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    /**
     * 设置审核状态接口
     *
     * @param picture
     * @param loginUser
     */
    void fillReviewParams(Picture picture, User loginUser);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest:图片批量添加请求体
     * @param loginUser:                            登录用户【指定管理员】
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );

    /**
     * 百度图库获取图片
     *
     * @param pictureUploadByBatchRequest:图片批量添加请求体
     * @param loginUser:登录用户【指定管理员】
     * @return
     */
    Integer uploadPictureByBatchInBaiDu(PictureUploadByBatchRequest pictureUploadByBatchRequest, User loginUser);

    /**
     * 删除图片
     */
    void deletePicture(long pictureId, User loginUser);

    /**
     * 权限校验
     *
     * @param loginUser
     * @param picture
     */
    void checkPictureAuth(User loginUser, Picture picture);

    /**
     * 异步清理文件
     *
     * @param oldPicture
     */
    void clearPictureFile(Picture oldPicture);

    /**
     * 编辑图片
     *
     * @param pictureEditRequest
     * @param loginUser
     */
    void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

    /**
     * 按颜色查找图片接口
     *
     * @param spaceId    : 空间ID
     * @param picColor:  图片十六进制颜色值
     * @param userLogin: 登录用户
     * @return
     */
    List<PictureVO> searchPictureByColor(Long spaceId, String picColor, User userLogin);

    /**
     * 批量处理接口
     */
    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, User userLogin);


    /**
     * AI扩图请求接口
     * @param createPictureOutPaintingTaskRequest
     * @param loginUser
     * @return
     */
    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);


    /**
     * AI图片生成视频请求接口
     * @param createPictureOutMp4TaskRequest
     * @param loginUser
     * @return
     */
    CreateOutMp4askResponse createPictureOutMp4Task(CreatePictureOutMp4TaskRequest createPictureOutMp4TaskRequest, User loginUser);
}
